package org.jeemp.test;

import com.alibaba.fastjson.JSON;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.util.StringUtils;

import java.math.BigDecimal;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import java.util.stream.IntStream;

import static java.util.stream.Collectors.toList;

@SpringBootApplication
public class JeempTestApplication {
    private static Logger logger = LoggerFactory.getLogger(JeempTestApplication.class);
    public static void main(String[] args) {
//        SpringApplication.run(JeempTestApplication.class, args);
//        checkListMerge();
//        logger.info("日期：{}", DateUtil.getDateMinuteBefore(new Date(),8));
//        checkMap();
//        parseMap();
//        List<Long> encounterTag = new ArrayList<>();
//        encounterTag.add(98175L);
//        Set<Long> tagSet = new HashSet(encounterTag);
//        logger.info("数据：{}",JSON.toJSONString(tagSet));
//        checkList();
//        checkForStr();

//        logger.info("是否全部中文：{}",JSON.toJSONString(isChineseStr()));

//        logger.info("滞留时长：{}",JSON.toJSONString(calculateDBetweenDate(string2Date("2023-10-26 12:00:30"),null)));
//        checkListMerge();
//        splitStr();
//        logger.info("是否包含中文或字母：{}",containsLetterOrChinese("测"));
//        logger.info("向上取整结果：{}",upDoubleNumber(2.2));

        //logger.info("是否为整数结果：{}",isInteger(2.0));
        //
        //logger.info("是否为整数结果：{}",isInteger(2.2));

        //logger.info("查询次数结果：{}",queryNum(200L));
        //
        //logger.info("查询次数结果：{}",queryNum(201L));
        //
        //logger.info("查询次数结果：{}",queryNum(300L));
        //
        //logger.info("查询次数结果：{}",queryNum(400L));
        //
        //logger.info("查询次数结果：{}",queryNum(401L));

        IntStream.rangeClosed(1, 3).forEach(nextPageNo->{
            logger.info("循环第几次：{}",nextPageNo);
        });
    }



    public static Integer queryNum(Long num) {
        return num.intValue()/200+(num.intValue()%200!=0?1:0);
    }

    public static boolean isInteger(double num) {
        return num % 1 == 0;
    }

    //向上取整
    public static  double upDoubleNumber(Double num) {
        BigDecimal decimal = new BigDecimal(num);
        BigDecimal ceilDecimal = decimal.setScale(0, BigDecimal.ROUND_UP);
        return ceilDecimal.doubleValue();
    }

    //向上取整
    public static  int upNumber(Double num) {
        BigDecimal decimal = new BigDecimal(num);
        BigDecimal ceilDecimal = decimal.setScale(0, BigDecimal.ROUND_UP);
        return ceilDecimal.intValue();
    }


    public static void valivateFor() {
        List<Long> list = new ArrayList<>();
        list.add(1L);
        list.add(2L);
        for (Long item:list) {
            logger.info("123:"+item);
            return;
        }
    }

    public static boolean containsLetterOrChinese(String str) {
        // 正则表达式，匹配至少一个字母或汉字
        return str.matches(".*[a-zA-Z\u4e00-\u9fa5]+.*");
    }

    private static void splitStr() {
        String str = "/80";
        String[] strings = str.split("/");
        int index = str.indexOf("/");
        int strLength = str.length();
        if (strLength <=1){
            //长度小于1就是个/,不处理
        }else if (index==0) {
            logger.info("2:{}",strings[1]);
        }else if(strings.length==2){
            logger.info("1:{},2:{}",strings[0],strings[1]);
        }else {
            logger.info("1:{}",strings[0]);
        }
    }

    private static String calculateDBetweenDate(Date startDate,Date endDate) {
        if (Objects.isNull(endDate)) {
            endDate = new Date();
        }
        String dateFormat = "";
        long diffTimes = endDate.getTime()-startDate.getTime();
        long days = diffTimes/(1000*60*60*24);
        if (days >0) {
            dateFormat = dateFormat+days+"天";
            long milliseconds = diffTimes%(1000*60*60*24);
            long hours = milliseconds/(1000*60*60);
            if (hours > 0) {
                dateFormat = dateFormat+hours+"小时";
                milliseconds = milliseconds%(1000*60*60);
                long minute =milliseconds/ (1000*60);
                if (minute>0) {
                    dateFormat = dateFormat+minute+"分钟";
                }
            }else {
                dateFormat = dateFormat+"0小时";
                milliseconds = milliseconds%(1000*60*60);
                long minute =milliseconds/ (1000*60);
                if (minute>0) {
                    dateFormat = dateFormat+minute+"分钟";
                }
            }
        }else  {
            long hours = diffTimes/(1000*60*60);
            if (hours > 0) {
                dateFormat = dateFormat+hours+"小时";
                long milliseconds = diffTimes%(1000*60*60);
                long minute =milliseconds/ (1000*60);
                if (minute>0) {
                    dateFormat = dateFormat+minute+"分钟";
                }
            }else {
                long milliseconds = diffTimes%(1000*60*60);
                long minute =milliseconds/ (1000*60);
                if (minute>0) {
                    dateFormat = dateFormat+minute+"分钟";
                }else {
                    dateFormat = "0分钟";
                }
            }
        }
        return dateFormat;
    }

    public static Date string2Date(String dateString) {
        dateString = dateString.trim();
        Date date = null;
        if (dateString == null || dateString.isEmpty()) {
            return null;
        }
        if (dateString.indexOf("-") != -1) {
            if (dateString.split("-").length == 3) {
                if (dateString.indexOf(":") != -1) {
                    if (dateString.split(":").length == 3) {
                        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
                        try {
                            date = simpleDateFormat.parse(dateString);
                        } catch (ParseException e) {
                            logger.error("字符串转时间异常：" + e.getMessage());
                        }
                    } else if (dateString.split(":").length == 2) {
                        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm");
                        try {
                            date = simpleDateFormat.parse(dateString);
                        } catch (ParseException e) {
                            logger.error("字符串转时间异常：" + e.getMessage());
                        }
                    }
                } else if (dateString.indexOf("/") != -1) {
                    if (dateString.split("/").length == 3) {
                        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH/mm/ss");
                        try {
                            date = simpleDateFormat.parse(dateString);
                        } catch (ParseException e) {
                            logger.error("字符串转时间异常：" + e.getMessage());
                        }
                    } else if (dateString.split("/").length == 2) {
                        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH/mm");
                        try {
                            date = simpleDateFormat.parse(dateString);
                        } catch (ParseException e) {
                            logger.error("字符串转时间异常：" + e.getMessage());
                        }
                    }
                } else {
                    int index = dateString.lastIndexOf("-");
                    dateString = dateString.substring(0, dateString.length() < (index + 3) ? dateString.length() : index + 3).trim();
                    SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
                    try {
                        date = simpleDateFormat.parse(dateString);
                    } catch (ParseException e) {
                        logger.error("字符串转时间异常：" + e.getMessage());
                    }
                }
            }
        } else if (dateString.indexOf("/") != -1) {
            if (dateString.indexOf(":") != -1) {
                if (dateString.lastIndexOf("/") < dateString.indexOf(":")) {
                    if (dateString.split("/").length == 3) {
                        if (dateString.indexOf(":") != -1) {
                            if (dateString.split(":").length == 3) {
                                SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss");
                                try {
                                    date = simpleDateFormat.parse(dateString);
                                } catch (ParseException e) {
                                    logger.error("字符串转时间异常：" + e.getMessage());
                                }
                            } else if (dateString.split(":").length == 2) {
                                SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy/MM/dd HH:mm");
                                try {
                                    date = simpleDateFormat.parse(dateString);
                                } catch (ParseException e) {
                                    logger.error("字符串转时间异常：" + e.getMessage());
                                }
                            }
                        } else {
                            int index = dateString.lastIndexOf("/");
                            dateString = dateString.substring(0, dateString.length() < (index + 3) ? dateString.length() : index + 3).trim();
                            SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy/MM/dd");
                            try {
                                date = simpleDateFormat.parse(dateString);
                            } catch (ParseException e) {
                                logger.error("字符串转时间异常：" + e.getMessage());
                            }
                        }
                    }
                }
            } else if (dateString.split("/").length == 3) {
                SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy/MM/dd");
                try {
                    date = simpleDateFormat.parse(dateString);
                } catch (ParseException e) {
                    logger.error("字符串转时间异常：" + e.getMessage());
                }
            } else if (dateString.split("/").length == 4) {
                SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy/MM/dd HH/mm");
                try {
                    date = simpleDateFormat.parse(dateString);
                } catch (ParseException e) {
                    logger.error("字符串转时间异常：" + e.getMessage());
                }
            } else if (dateString.split("/").length > 4) {
                SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy/MM/dd HH/mm/ss");
                try {
                    date = simpleDateFormat.parse(dateString);
                } catch (ParseException e) {
                    logger.error("字符串转时间异常：" + e.getMessage());
                }
            }
        }
        if (date == null) {
            SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
            try {
                date = simpleDateFormat.parse(dateString);
            } catch (ParseException e) {
                logger.error("字符串转时间异常：" + e.getMessage());
            }
        }
        return date;
    }


    public static Boolean isChineseStr() {
        String str = "中国万岁";
        Pattern pattern = Pattern.compile("[\u4e00-\u9fa5]");
        char c[] = str.toCharArray();
        for(int i=0;i<c.length;i++){
            Matcher matcher = pattern.matcher(String.valueOf(c[i]));
            if(!matcher.matches()){
                return false;
            }
        }
        return true;
    }


    public static void checkForStr(){
        List<String> str = new ArrayList<>();
        List<Long> encounterIds = new ArrayList<>();
        encounterIds.add(1L);
        encounterIds.stream().forEach(hospitalSOID -> {
            str.add("123");
        });
        logger.info("结果为：{}", JSON.toJSON(str));
    }


    public static void checkStr() {
        String str ="-1";
        logger.info("抓换结果为：{}",Integer.valueOf(str));
    }

    public static void checkList() {
        String str = "149383379928811521,149383379928811521,149383379928811521,149383379928811521,149383379928811521,149383379928811521,255480612717443072,255480612717443072,255480612717443072";
        List<String> visitedDoctorIds = Arrays.asList(str.split(","));
        logger.info("处理后接口：{}",JSON.toJSONString(visitedDoctorIds.stream().map(visitedDoctorId -> Long.valueOf(visitedDoctorId.trim())).collect(toList())));
    }

    public static void checkMap() {
        Map<String,Map<String,Object>> dataMap = new HashMap<>();
        Map<String,Object> childMap = new HashMap<>();
        childMap.put("totalAmount",0.0);
        childMap.put("essNo","00");
        dataMap.put("010",childMap);
        Map<String,Object> souAmount = new HashMap<>();
        for (String key : dataMap.keySet()) {
            souAmount = dataMap.get(key);
        }
        System.out.println(souAmount);
    }

    public static void checkListMerge() {
        List<Long> list1 = new ArrayList<>();
        list1.add(1L);
        list1.add(2L);

        List<Long> list2 = new ArrayList<>();
        list2.add(2L);
        list2.add(3L);
        list2.add(4L);

        //取并集(不去重)
//        list1.addAll(list2);
//        logger.info(JSON.toJSONString(list1));//[1,2,2,3,4]

//        //取并集(去重)
//        list1.removeAll(list2);
//        list1.addAll(list2);
//        logger.info(JSON.toJSONString(list1));//[1,2,3,4]

        //取交集
//        list1.retainAll(list2);
//        logger.info(JSON.toJSONString(list1));//[2]


    }

    public static void parseMap() {
        String str = "\"{\"code\":0,\"msg\":\"\",\"patientphoto\":\"/9j/4AAQSkZJRgABAQEAAAAAAAD/2wBDAAcHBwcIBwgJCQgMDAsMDBEQDg4QERoSFBIUEhonGB0YGB0YJyMqIiAiKiM+MSsrMT5IPDk8SFdOTldtaG2Pj8D/2wBDAQcHBwcIBwgJCQgMDAsMDBEQDg4QERoSFBIUEhonGB0YGB0YJyMqIiAiKiM+MSsrMT5IPDk8SFdOTldtaG2Pj8D/wgARCADwAPADASIAAhEBAxEB/8QAHAABAAIDAQEBAAAAAAAAAAAAAAYHBAUIAwEC/9oACAEBAAAAAOkQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD59A+YuWMPMAVzrbYVDG9xA+pqm1dYWlL8+vIja+694rSN9Zk3546HFT666VaVr6uj/tFxG3rE8eZZlhWFLef7R11g5fMvTQ5nw+ov1y/d8FrzquiNroPC0K9j1qUJ0ZHKknUE6Bm9HXiU3+5RT3R1exvC0PS+Mo3oDyUF0Dzn0bp6Etirbw31QW+woHZKJ59VT2aw/zmfhFJm/FfZ/hPFO7pmzsAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAf//EABcBAQEBAQAAAAAAAAAAAAAAAAABAgP/2gAIAQIQAAAAAAAAAAAAAAAAAAASkrO4AzvNSs9Mpbm2CTcAAAAAAAAAAAAAAAf/xAAWAQEBAQAAAAAAAAAAAAAAAAAAAQL/2gAIAQMQAAAAAAAAAAAAAAAAAAACVNZqULmxqLjSyakUXGgAAAAAAAAAAAAAAH//xAAyEAABBQEAAQIDBAkFAAAAAAAEAQIDBQYHABAREhMVFiA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HnB5w3tX5Rtr+wtNsToET6Zivq0RBbHUHQoyIA1OqoNn+JoO/lC+INmmIQ/dlO9Mj5NwDAnqmkgz1UQa0Uw6RZAooaQhpCdYYNnTg8rRs6U7kDRuDiQOI5w+6VEArpHtz/9k=\"}\"";
        System.out.println(str);
        int beginIndex = str.indexOf("\"") == 0 ? 1 : 0;
        int endIndex = str.lastIndexOf("\"") + 1 == str.length() ? str.lastIndexOf("\"") : str.length();

        String str1 = str.substring(beginIndex,endIndex);
        System.out.println(str1);
        String str2 = "{\"code\":0,\"msg\":\"\",\"patientphoto\":\"/9j/4AAQSkZJRgABAQEAAAAAAAD/2wBDAAcHBwcIBwgJCQgMDAsMDBEQDg4QERoSFBIUEhonGB0YGB0YJyMqIiAiKiM+MSsrMT5IPDk8SFdOTldtaG2Pj8D/2wBDAQcHBwcIBwgJCQgMDAsMDBEQDg4QERoSFBIUEhonGB0YGB0YJyMqIiAiKiM+MSsrMT5IPDk8SFdOTldtaG2Pj8D/wgARCADwAPADASIAAhEBAxEB/8QAHAABAAIDAQEBAAAAAAAAAAAAAAYHBAUIAwEC/9oACAEBAAAAAOkQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD59A+YuWMPMAVzrbYVDG9xA+pqm1dYWlL8+vIja+694rSN9Zk3546HFT666VaVr6uj/tFxG3rE8eZZlhWFLef7R11g5fMvTQ5nw+ov1y/d8FrzquiNroPC0K9j1qUJ0ZHKknUE6Bm9HXiU3+5RT3R1exvC0PS+Mo3oDyUF0Dzn0bp6Etirbw31QW+woHZKJ59VT2aw/zmfhFJm/FfZ/hPFO7pmzsAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAf//EABcBAQEBAQAAAAAAAAAAAAAAAAABAgP/2gAIAQIQAAAAAAAAAAAAAAAAAAASkrO4AzvNSs9Mpbm2CTcAAAAAAAAAAAAAAAf/xAAWAQEBAQAAAA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pZZfgUYZ+XP/8QAKBEAAQQBAgUDBQAAAAAAAAAAAQACESEQMVEDMkFhcTNgYhJSgZGh/9oACAEDAQE/APbZoMO5Iwai9RKNNJ2EnHScASQEDM4NCe+DTS7wM8QUPhZHnB5w3tX5Rtr+wtNsToET6Zivq0RBbHUHQoyIA1OqoNn+JoO/lC+INmmIQ/dlO9Mj5NwDAnqmkgz1UQa0Uw6RZAooaQhpCdYYNnTg8rRs6U7kDRuDiQOI5w+6VEArpHtz/9k=\"}";
//        StringEscapeUtils.unescapeJava(String data)
        Map<String,Object> responseMap = JSON.parseObject(str2,Map.class);
        System.out.println(responseMap);
        if ("0".equals(String.valueOf(responseMap.get("code")))) {
            System.out.println(String.valueOf(responseMap.get("patientphoto")));
        }
    }

    public static void parseCase() {
        String cardNo = "411422199003262195x";
        String regex = "^[0-9]*$";
        if (!cardNo.matches(regex)) {
            String cardNO1 = cardNo.toUpperCase();
            logger.info("cardNo1:" + cardNO1);
            String cardNo2 = cardNo.toLowerCase();
            logger.info("cardNo2:" + cardNo2);
        }else {
            logger.info(cardNo);
        }
    }



}
